package com.mly.data;


import com.mly.data.algo.designMode.State.CBasic;
import com.mly.data.algo.designMode.State.FrequentFlyer;
import com.mly.data.algo.designMode.State.MarioStateMachine;
import com.mly.data.algo.designMode.State.State;
import com.mly.data.algo.dynamicPlan.*;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class DataApplication {

    public static void main(String[] args) {
//        SpringApplication.run(DataApplication.class, args);
        //------------------------------------------------
        //算法与数据结构调试
//        int[] sortArr = {4,5,6,1,3,2};
//        int[] sortArr = {11,8,3,9,7,1,2,5};
//        int[] sortArr = {6,11,3,9,8};
//        int[] sortArr = {4,2,5,12,3};
//        Sorts sorts = new Sorts(sortArr, 5);
//        int[] sort = sorts.kSort();

//        show(sort);
        //------------------------------------------------
        //设计模式调试
//        FrequentFlyer frequentFlyer = new FrequentFlyer();
//        frequentFlyer.travel(100);
//        frequentFlyer.setState( new CBasic());
//        frequentFlyer.travel(100);
//        frequentFlyer.show();

//        MarioStateMachine mario = new MarioStateMachine();
//        mario.obtainMushRoom();
//        int score = mario.getScore();
//        State state = mario.getCurrentState();
//        System.out.println("mario score: " + score + "; state: " + state);

//        char str[] = {'A','C','C','G','G','U','A','G','U'};
//        RNA_3.f(0,0);
        int[] weight = {2, 2, 4, 6, 3};
        int[] value = {3, 4, 8, 9, 6}; // 物品的价值
        int n = 5; // 物品个数
        int w = 9; // 背包承受的最大重量
//        int maxW = RNA_4.knapsack(weight,n,w);
        int maxW = RNA_6.knapsack3(weight, value, n, w);
        System.out.println("maxW: " + maxW);


    }

    public static void show(int[] sort) {
        for (int i = 0; i < sort.length; i++) {
            System.out.print(sort[i] + " ");
        }
        System.out.println();
    }

}
